package com.sxj.corejava.code08_常用类.其他类;

/**
 * @author 石小俊
 * 2024年07月23日 10:20
 */
public class Test02_Math {
    public static void main(String[] args) {
        // 获取4-7的随机数
        System.out.println((int)(Math.random() * (7 - 4 + 1) + 4));
        System.out.println(Math.abs(2));
        System.out.println(Math.abs(-2));

        System.out.println(Math.round(3.14));
        System.out.println(Math.round(3.56));

        System.out.println(Math.PI);
        System.out.println(Math.E);

        System.out.println(Math.floor(3.14));
        System.out.println(Math.floor(-3.14));

        System.out.println(Math.ceil(3.14));
        System.out.println(Math.ceil(-3.14));

        System.out.println(Math.pow(2,3));
        System.out.println(Math.pow(2,0));
        System.out.println(Math.pow(2,-2));

        System.out.println(Math.max(-2,-3));
        System.out.println(Math.min(-2,-3));

        System.out.println(Math.sqrt(4));
        System.out.println(Math.sqrt(2));
    }
}
